import Vue from 'vue'
import VueRouter from 'vue-router'
import Login from '@/views/Login'
import Layout from '@/layout'
import Register from '@/views/Register'

Vue.use(VueRouter)

const routes = [
	{
		path: '/login',
		name: 'Login',
		component: Login
	},
	{
		path: '/register',
		name: 'Register',
		component: Register
	},
	{
		path: '/',
		name: 'Layout',
		component: Layout,
		redirect: '/index',
		children: [
			{
				path: '/index',
				component: () => import('@/views/Index')
			}
		]
	},
	// 动态添加
	
]
export const endRoutes = [{ path: '*', redirect: '/404', hidden: true }]
const router = new VueRouter({
	mode: 'history',
	// base: process.env.BASE_URL,
	base: process.env.NODE_ENV === "production" ? "/wscms" : "/wscms",
	routes

})

export default router
